package _go

func removeDuplicates(nums []int) int {
	l := len(nums)

	if l <= 1 {
		return l
	}

	for i := 1; i < l; i++ {
		if nums[i] == nums[i-1] {
			nums = append(nums[:i], nums[i+1:]...)
			l--
			i--
		}
	}
	return l
}
